<?php
class Product_Form_Product_Update extends Zend_Form
{
	public function __construct(Zend_Controller_Action $controller)
	{
		//product_code
		$product_code=$this->createElement ( 'text', 'product_code' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_code') )
		->setDescription($controller->getHelper('common')->getDescription('product_code') )
		->setRequired(true)
		;
		
		//product_name
		$product_name=$this->createElement ( 'text', 'product_name' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_name') )
		->setDescription($controller->getHelper('common')->getDescription('product_name') )
		->setRequired(true)
		;
		
		//product_product_group_code
		$product_product_group_code=$this->createElement ( 'select', 'product_product_group_code' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_product_group_code') )
		->setDescription($controller->getHelper('common')->getDescription('product_product_group_code') )
		->setRequired(true)
		;
		
		//product_unit_change_code
		$product_unit_change_code = $this->createElement ( 'multiselect', 'product_unit_change_code' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_unit_change_code') )
		->setDescription($controller->getHelper('common')->getDescription('product_unit_change_code') )
		->setRequired(true)
		;			
		
		//product_warehouse_group_code
		$product_warehouse_group_code=$this->createElement ( 'select', 'product_warehouse_group_code' )
		->setDescription($controller->getHelper('common')->getDescription('product_warehouse_group_code') )
		->setLabel ( $controller->getHelper('common')->getCaption('product_warehouse_group_code') )
		;
		
		//product_instore_max
		$product_instore_max=$this->createElement ( 'text', 'product_instore_max' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_instore_max') )
		->setDescription($controller->getHelper('common')->getDescription('product_instore_max') )
		->addValidator ( 'Int' )
		->setAttrib ( 'class','numeric' )
		;
		
		//product_instore_min
		$product_instore_min=$this->createElement ( 'text', 'product_instore_min' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_instore_min') )
		->setDescription($controller->getHelper('common')->getDescription('product_instore_min') )
		->addValidator ( 'Int' )
		->setAttrib ( 'class','numeric' )
		;
		
			//product_instore_unit_code
		$product_instore_unit_code=$this->createElement ( 'select', 'product_instore_unit_code' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_instore_unit_code') )
		->setDescription($controller->getHelper('common')->getDescription('product_instore_unit_code') )
		;
		
		//product_note
		$product_note=$this->createElement ( 'textarea', 'product_note' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_note') )
		;
		
		//product_type
		$product_type=$this->createElement ( 'select', 'product_type' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_type') )
		->setRequired(true)
		;
		
		//product_status
		$product_status=$this->createElement ( 'radio', 'product_status' )
		->setLabel ( $controller->getHelper('common')->getCaption('product_status') )
		->setAttrib ( 'class','numeric' )
		->setMultiOptions(array(1=>'Kích hoạt',0=>'Vô hiệu'))
		->setDescription($controller->getHelper('common')->getDescription('product_status') )
		->setValue(1)
		;
		
		$this->addElements ( array (
			//$product_type,
			//$product_warehouse_group_code,
			//$product_product_group_code,
			$product_code,
			$product_name,
			
			//$product_unit_change_code,
			//$product_instore_unit_code,			
			//$product_instore_max,
			//$product_instore_min,
			$product_note,			
			$product_status,
		) );	
		
		$controller->getHelper ( 'common' )->form ( $this );
	}
}